import { menuFunction } from "@/utils/contextMenu";
import { store, widget, closeContextMenu } from "@/utils/global";
import { ElMessageBox, ElMessage } from "element-plus";
/**
 * 全局静态配置
 */

/**
 * 矢量工具选项配置
 */
export const tool = [
    {
        name: "图上文字",
        icon: "fa fa-font",
        type: "graphicText",
    },
    {
        name: "图上标点",
        icon: "fa fa-map-pin",
        type: "punctuation",
    },
    {
        name: "图上线段",
        icon: "fa fa-lastfm",
        type: "segment",
    },
    {
        name: "二维平面",
        icon: "fa fa-th",
        type: "twodimension",
    },
    {
        name: "三维立体",
        icon: "fa fa-cube",
        type: "threedimensional",
    },
    {
        name: "加载模型",
        icon: "fa fa-cubes",
        type: "loadmodel",
    },
    {
        name: "地图打印",
        icon: "fa fa-print",
        type: "print",
    },
];
/**
 * 图层树数据设置
 */
export const defaultProps = {
    children: "children",
    label: "name",
};
/**
 * 右键菜单配置
 */
export const contextMenu = [
    // 图层数据
    // 属性
    {
        name: "属性",
        icon: "fa fa-edit",
        separate: true,
        authority: true,
        identification: "draw,mapDraw",
        click: () => {
            // 激活编辑状态
            closeContextMenu();
            menuFunction.graphicEditing();
        },
    },
    // 剪切
    {
        name: "剪切",
        icon: "fa fa-cut",
        authority: true,
        identification: "draw,xyz,folder,mapDraw",
        click: () => {
            closeContextMenu();
            menuFunction.cut();
        },
    },
    // 复制
    {
        name: "复制",
        icon: "fa fa-clone",
        authority: true,
        identification: "draw,xyz,folder",
        click: () => {
            closeContextMenu();
            menuFunction.copy();
        },
    },
    // 删除
    {
        name: "删除",
        icon: "fa fa-trash-o",
        authority: true,
        identification: "draw,xyz,mapDraw,sign",
        click: () => {
            closeContextMenu();
            menuFunction.removeGraphic();
        },
    },
    // 粘贴
    {
        name: "粘贴",
        identification: "paste",
        separate: true,
        authority: true,
        icon: "fa fa-files-o",
        click: () => {
            closeContextMenu();
            menuFunction.paste();
        },
    },
    // {
    //     name: "另存为",
    //     identification: "folder",
    //     separate: true,
    //     authority: true,
    //     icon: "fa fa-file-o",
    //     click: () => {
    //         // closeContextMenu()
    //     },
    // },
    // 统计
    {
        name: "统计",
        identification: "folder,paste",
        authority: true,
        separate: true,
        icon: "fa fa-bar-chart",
        click: () => {
            closeContextMenu();
            // ElMessage.error("该功能暂未开放！");
            menuFunction.statistics();
        },
    },
    // 重命名
    {
        name: "重命名",
        identification: "xyz,folder,paste",
        authority: true,
        icon: "fa fa-edit",
        click: () => {
            closeContextMenu();
            menuFunction.renameTreeFloader();
        },
    },
    // 删除内容
    {
        name: "删除内容",
        identification: "folder,paste",
        authority: true,
        icon: "fa fa-file-text-o",
        click: () => {
            closeContextMenu();
            menuFunction.deleteTreeFloaderContent();
        },
    },
    // 锁定
    {
        name: "锁定",
        identification: "folder,paste",
        authority: true,
        separate: true,
        icon: "fa fa-lock",
        click: () => {
            closeContextMenu();
            menuFunction.lockTreeFloader();
        },
    },
    // 保存文件夹
    {
        name: "保存文件夹",
        identification: "folder,paste",
        authority: true,
        icon: "fa fa-save",
        click: () => {
            closeContextMenu();
            menuFunction.saveTreeFloader();
        },
    },
    // 添加文件夹
    {
        name: "添加文件夹",
        identification: "folder,paste",
        authority: true,
        icon: "fa fa-folder-open-o",
        click: () => {
            closeContextMenu();
            menuFunction.addTreeFloader();
        },
    },
    // 删除文件夹
    {
        name: "删除文件夹",
        identification: "folder,paste",
        authority: true,
        icon: "fa fa-trash-o",
        click: () => {
            closeContextMenu();
            menuFunction.deleteTreeFloader();
        },
    },
    // 解锁
    {
        name: "解除锁定",
        identification: "unlock",
        authority: true,
        icon: "fa fa-unlock",
        click: () => {
            closeContextMenu();
            menuFunction.unlockTreeFloader();
        },
    },
];
/**
 * 打印配置
 */
export const print = [
    {
        label: "A4纸横向",
        value: 1,
        style: {
            width: "287mm",
            height: "195mm",
            transform: "matrix(1, 0, 0, 1, 0, 0)",
        },
    },
    {
        label: "A4纸纵向",
        value: 2,
        style: {
            width: "200mm",
            height: "287mm",
            transform: "matrix(0.873616, 0, 0, 0.873616, 0, 0)",
        },
    },
    {
        label: "A3纸横向",
        value: 3,
        style: {
            width: "410mm",
            height: "282mm",
            transform: "matrix(0.833441, 0, 0, 0.833441, 0, 0)",
        },
    },
    {
        label: "A3纸纵向",
        value: 4,
        style: {
            width: "287mm",
            height: "410mm",
            transform: "matrix(0.611362, 0, 0, 0.611362, 0, 0)",
        },
    },
    {
        label: "A2纸横向",
        value: 5,
        style: {
            width: "594mm",
            height: "420mm",
            transform: "matrix(0.6, 0, 0, 0.6, -162, 0)",
        },
    },
    {
        label: "A2纸纵向",
        value: 6,
        style: {
            width: "420mm",
            height: "594mm",
            transform: "matrix(0.43, 0, 0, 0.43, 0,0)",
        },
    },
    {
        label: "A1纸横向",
        value: 7,
        style: {
            width: "841mm",
            height: "594mm",
            transform: "matrix(0.43, 0, 0, 0.43, -630, 0)",
        },
    },
    {
        label: "A1纸纵向",
        value: 8,
        style: {
            width: "594mm",
            height: "841mm",
            transform: "matrix(0.3, 0, 0, 0.3, 0,0)",
        },
    },
    {
        label: "A0纸横向",
        value: 9,
        style: {
            width: "841mm",
            height: "1189mm",
            transform: "matrix(0.35, 0, 0, 0.21, -612, 0)",
        },
    },
    {
        label: "A0纸纵向",
        value: 10,
        style: {
            width: "1189mm",
            height: "841mm",
            transform: "matrix(0.3, 0, 0, 0.295, -1292,0)",
        },
    },
];
/**
 * 图层默认颜色
 */
export const defaultColor = [
    "#000000",
    "#FFFFFF",
    "#FF1900",
    "#F47365",
    "#FFB243",
    "#FFE623",
    "#6EFF2A",
    "#1BC7B1",
    "#00BEFF",
    "#2E81FF",
    "#5D61FF",
    "#FF89CF",
    "#FC3CAD",
    "#BF3DCE",
    "#8E00A7",
    "rgba(0, 0, 0, 0)",
];
/**
 * 字体配置
 */
export const fontFamily = [
    {
        label: "宋体",
        value: "宋体",
    },
    {
        label: "微软雅黑",
        value: "微软雅黑",
    },
    {
        label: "楷体",
        value: "楷体",
    },
    {
        label: "隶书",
        value: "隶书",
    },
    {
        label: "黑体",
        value: "黑体",
    },
];
/**
 * 获取图层树数据
 */
export const getCascaderData = () => {
    let cascaderData = JSON.parse(JSON.stringify(store.treeData));
    return filterFolders(cascaderData);
};
/**
 * 过滤数据
 * @param data
 * @returns
 */
const filterFolders = (data: any) => {
    return data
        .filter((item: any) => item.type === "folder")
        .map((item: any) => ({
            ...item,
            disabled: !item.editor ? true : false,
            children: filterFolders(item.children),
        }));
};
/**
 * 填充材质配置
 */
export const material: any = {
    // 实线 纯色
    Color: {
        color: "#ffff00", // 颜色
    },
    // 虚线
    PolylineDash: {
        color: "#ffff00", // 颜色
        gapColor: "rgba(1,1,1,0)", // 虚线间隔颜色，默认为透明
        dashLength: 16, // 虚线间隔长度，以像素为单位
    },
    // 衬色线
    PolylineOutline: {
        // color: "#ffff00", // 颜色
        outlineColor: "#ffffff", // 衬色颜色
        outlineWidth: 1, // 衬色宽度，以像素为单位
    },
    // 箭头
    PolylineArrow: {
        color: "#ffff00", // 颜色
    },
    // OD线
    ODLine: {
        color: "#ffff00", // 颜色
        bgColor: "rgba(0,0,0,7)", // 线的背景颜色
        speed: 20, // 速度，值越大越快
        bidirectional: 0, // 运行形式,可选值：0 正向运动 1 反向运动 2 双向运动
    },
    // 网格
    Grid: {
        color: "#F0F000",
        cellAlpha: 0.1, // 填充透明度
        lineCount: 10, // 网格线的数量
        lineThickness: 1, // 网格线的粗细
    },
    //  放大扩散线
    ScanLine: {
        color: "#F0F000",
        speed: 10, // 速度
    },
    // 波纹扩散
    CircleWave: {
        color: "#F0F000",
        speed: 10, // 速度
        count: 2, // 圆圈个数
        gradient: 0.1, // 透明度的幂方（0-1）,0表示无虚化效果，1表示虚化成均匀渐变
    },
    // 棋盘
    Checkerboard: {
        evenColor: "#00FF45", // 主色
        oddColor: "#FF0014", // 衬色，棋盘中另外一个颜色
        repeat: 10, // 数量，在每个方向重复的次数
    },
    // 电弧球体
    EllipsoidElectric: {
        color: "#00FF45", // 主色
        speed: 10, // 速度
    },
    // 波纹球体
    EllipsoidWave: {
        color: "#00FF45", // 主色
        speed: 10, // 速度
    },
};
/**
 * 线型配置
 */
export const lineType: any = [
    {
        label: "实线",
        value: "Color",
    },
    {
        label: "虚线",
        value: "PolylineDash",
    },
    {
        label: "衬色线",
        value: "PolylineOutline",
    },
    {
        label: "箭头",
        value: "PolylineArrow",
    },
    {
        label: "OD线",
        value: "ODLine",
    },
];
/**
 * OD线运行形式
 */
export const bidirectional: any = [
    {
        label: "正向运动",
        value: 0,
    },
    {
        label: "反向运动",
        value: 1,
    },
    {
        label: "双向运动",
        value: 2,
    },
];
/**
 * 围栏填充材质配置
 */
export const railfence: any = [
    {
        label: "纯色",
        value: "Color",
    },
    {
        label: "网格",
        value: "Grid",
    },
];
/**
 * 平面方向配置
 */
export const planeDirection: any = [
    {
        label: "X轴",
        value: "x",
    },
    {
        label: "Y轴",
        value: "y",
    },
    {
        label: "Z轴",
        value: "z",
    },
];
/**
 * 圆的填充材质配置
 */
export const circleConfiguration: any = [
    {
        label: "纯色",
        value: "Color",
    },
    {
        label: "放大扩散线",
        value: "ScanLine",
    },
    {
        label: "波纹扩散",
        value: "CircleWave",
    },
];
/**
 * 圆的填充材质配置
 */
export const BoxConfiguration: any = [
    {
        label: "纯色",
        value: "Color",
    },
    {
        label: "棋盘",
        value: "Checkerboard",
    },
];
/**
 * 球及椭球 - 雷达及半球 填充材质配置
 */
export const ellipsoidConfiguration: any = [
    ...circleConfiguration,
    {
        label: "电弧球体",
        value: "EllipsoidElectric",
    },

    {
        label: "波纹球体",
        value: "EllipsoidWave",
    },
];
